package rad.framework.mda.generator.preferences;

import rad.framework.mda.generator.GeneratorPlugin;

import org.eclipse.jface.preference.IPreferenceStore;

/**
 * @author boudyacho
 *
 */
public class Preferences {

	public static IPreferenceStore getStore() {
		return GeneratorPlugin.getDefault().getPreferenceStore();
	}

	public static String getTemplateRoot() {
		return getStore().getString(PreferenceConstants.P_TEMPLATE_ROOT);
	}

	public static void setTemplateRootDefault() {
		getStore().setDefault(PreferenceConstants.P_TEMPLATE_ROOT,
				System.getProperty("user.home") + "/rad-framework/templates");
	}

	public static boolean isPluginIncluded(String name) {
		return getStore().getBoolean(name + PreferenceConstants.INCLUDE);
	}

	public static void setIncludePluginDefault(String plugin) {
		getStore().setDefault(plugin + PreferenceConstants.INCLUDE, "true");
	}

	public static String getSuffix(String name) {
		return getStore().getString(name + PreferenceConstants.SUFFIX);
	}

	public static void setSuffixDefault(String suffix) {
		getStore().setDefault(suffix + PreferenceConstants.SUFFIX, suffix);
	}

	public static boolean isIgnoreSkip() {
		return getStore().getBoolean(PreferenceConstants.IGNORE_SKIP);
	}

	public static boolean isSkipBackup() {
		return getStore().getBoolean(PreferenceConstants.SKIP_BACKUP);
	}
}
